#include "esp_camera.h"

void init_camera() {
    camera_config_t config = {
        .pin_pwdn = -1,
        .pin_reset = -1,
        .pin_xclk = 40,
        .pin_sccb_sda = 17,
        .pin_sccb_scl = 18,

        .pin_d7 = 39,
        .pin_d6 = 41,
        .pin_d5 = 42,
        .pin_d4 = 12,
        .pin_d3 = 3,
        .pin_d2 = 14,
        .pin_d1 = 47,
        .pin_d0 = 13,
        .pin_vsync = 21,
        .pin_href = 38,
        .pin_pclk = 11,

        .xclk_freq_hz = 20000000,
        .ledc_timer = LEDC_TIMER_0,
        .ledc_channel = LEDC_CHANNEL_0,

        .pixel_format = PIXFORMAT_JPEG,
        .frame_size = FRAMESIZE_QVGA,
        .jpeg_quality = 12,
        .fb_count = 2,
        .fb_location = CAMERA_FB_IN_PSRAM,
    };

    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK) {
        ESP_LOGE("CAM", "Camera Init Failed");
        return;
    }
}